package com.dmcliver.timetracker.builder;

import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import com.dmcliver.timetracker.entity.Person;
import com.dmcliver.timetracker.service.StandardHashService;

@AutoCreate
@Name("personBuilder")
public class PersonBuilderImpl implements PersonBuilder {

	@In
	private StandardHashService standardHashService;

	public Person build(String userName, String firstName, String lastName, String password){
		
		Person p = new Person(userName, firstName, lastName, null);
		String hash = standardHashService.hash(userName + password);
		p.setUserpassword(hash);
		return p;
	}
}
